
#include <string.h>
#include <cstring>
#include <unistd.h>
#include <stdio.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <strings.h>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <vector>
#include <pthread.h>
#include "client.h"

class TestClient : public clientTCP
{
public:
	TestClient(std::string const& host, int port) : clientTCP(host, port)
	{

	}
	void receiveBlock(com::Block const& block)
	{
		std::cout << "receiveBlock" << std::endl;
	}
};

int main (int argc, char* argv[])
{
	int  portNo;

	if(argc < 3)
	{
		cerr<<"Syntax : ./client <host name> <port>"<<endl;
		return 0;
	}

	portNo = atoi(argv[2]);

	if((portNo > 65535) || (portNo < 2000))
	{
		cerr<<"Please enter port number between 2000 - 65535"<<endl;
		return 0;
	}

	TestClient client(argv[1],portNo);

	while(true)
	{
		com::Block sendblock;

		sendblock.mutable_flowpacket()->set_payload("HejsaasssssssssssssssssssssssssssssssssssssssssssssssssssWHATsssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssWHATkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkWHATmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmMWHATllllllllllllllllllllllllllllllllllllllWHAT");

		client.sendString(sendblock);
	}

	client.join();
}
